package org.anachronos.jeep.agent.instrumentation;

import java.sql.PreparedStatement;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.util.regex.Pattern;

import com.google.common.collect.MapMaker;

public interface JdbcTracingConstants {
	static final String STATEMENT_CLAZZ = "java.sql.Statement";
	static final String PREPARED_STATEMENT_CLAZZ = "java.sql.PreparedStatement";
	static final String CONNECTION_CLAZZ = "java.sql.Connection";
	
	static final Set<String> INTERFACES = 
		new HashSet<String>(Arrays.asList(STATEMENT_CLAZZ, PREPARED_STATEMENT_CLAZZ, CONNECTION_CLAZZ));
	
	static final Pattern CONNECTION_METHOD_PATTERN = Pattern.compile("prepare(Call|Statement)?");
	static final Pattern STATEMENT_METHOD_PATTERN = Pattern.compile("execute(Query|Update)?"); // addBatch| (|Batch)
	
	static final Map<PreparedStatement, String> PREPARED_STATEMENT_MAP = 
		new MapMaker().weakKeys().makeMap();
}
